//
//  FilterHeaderView.m
//  Finance
//
//  Created by cheng xiang on 13-8-5.
//  Copyright (c) 2013年 cheng xiang. All rights reserved.
//

#import "FilterHeaderView.h"

@implementation FilterHeaderView
@synthesize delegate = _delegate,selectAllBtn = _selectAllBtn,selectNoneBtn = _selectNoneBtn,titleLabel = _titleLabel;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 100, 30)];
        [_titleLabel setBackgroundColor:[UIColor clearColor]];
        [_titleLabel setText:@"发行银行"];
        [_titleLabel setFont:[UIFont systemFontOfSize:15]];
        [self.contentView addSubview:_titleLabel];
        
        
        _selectAllBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        _selectAllBtn.frame = CGRectMake(150, 5, 60, 21);
        [_selectAllBtn addTarget:self action:@selector(clickAll) forControlEvents:UIControlEventTouchUpInside];
        [_selectAllBtn setBackgroundImage:[UIImage imageNamed:@"getall.png"] forState:UIControlStateNormal];
        [self.contentView addSubview:_selectAllBtn];
        
        _selectNoneBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        _selectNoneBtn.frame = CGRectMake(225, 5, 60, 21);
        [_selectNoneBtn addTarget:self action:@selector(clickNone) forControlEvents:UIControlEventTouchUpInside];
        [_selectNoneBtn setBackgroundImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal];
        [self.contentView addSubview:_selectNoneBtn];
    }
    return self;
}

- (void)clickNone
{
    if ([_delegate respondsToSelector:@selector(FilterSelectNone)]) {
        [_delegate performSelector:@selector(FilterSelectNone)];
    }
}

- (void)clickAll
{
    if ([_delegate respondsToSelector:@selector(FilterSelectAll)]) {
        [_delegate performSelector:@selector(FilterSelectAll)];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end

